package top.toptimus.dto.recipe;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import top.toptimus.constValue.CraftTypeConsts;

/**
 * 工艺外观设计创建于款式的关系DTO
 *
 * @author zhulan
 */
@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
@NoArgsConstructor
@Data
public class CraftDesignStyleRelationDTO extends GarmentPartBaseDTO {
    private String id;  //  id
    private String craftType;//工艺类别 top.toptimus.constValue.CraftTypeConsts
    private String styleCode; //  款号
    private String partId;  //  部位id
    private String partDesc;    //  部位描述    top.toptimus.recipe.dao.GarmentPartDao.id
    private String craftDesignId;   //  工艺设计要求项id  top.toptimus.recipe.dao.CraftDesignDao.id
    private String craftDesignCode;    //  工艺设计要求项编码
    private String craftDesignDesc;    //  工艺设计要求项描述

    public CraftDesignStyleRelationDTO(
            String id,
            String craftType,
            String styleCode,
            String partId,
            String partDesc,
            String craftDesignId,
            String craftDesignCode,
            String craftDesignDesc,
            Boolean reviewEdition,
            Boolean adjustEdition,
            Boolean tailoring,
            Boolean adhesive,
            Boolean workShop,
            Boolean halfSewing,
            Boolean specialType,
            Boolean finishedSewing,
            Boolean checkUp,
            Boolean seller
    ) {
        this.id = id;
        this.craftType = craftType;
        this.styleCode = styleCode;
        this.partId = partId;
        this.partDesc = partDesc;
        this.craftDesignId = craftDesignId;
        this.craftDesignCode = craftDesignCode;
        this.craftDesignDesc = craftDesignDesc;
        this.reviewEdition = reviewEdition;
        this.adjustEdition = adjustEdition;
        this.tailoring = tailoring;
        this.adhesive = adhesive;
        this.workShop = workShop;
        this.halfSewing = halfSewing;
        this.specialType = specialType;
        this.finishedSewing = finishedSewing;
        this.checkUp = checkUp;
        this.seller = seller;
    }

    /**
     * 可选设计点和参考工艺设计的build方法,参考工艺设计不提供数据库主键
     *
     * @param craftType 工艺设计类别常量
     * @return this
     */
    public CraftDesignStyleRelationDTO buildRef(String craftType) {
        if (CraftTypeConsts.PROCESS_PLANNING.equals(craftType)) {
            //  参考工艺设计不提供数据库主键
            this.id = null;
        }
        return this;
    }
}
